<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="pro_techpro" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 选择工序 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="上级工序" prop="techpro_tech">
              <el-input v-model="pro_techpro.techpro_tech" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="工序" prop="">
              {{pro_techpro.techpro_pro}}
              <el-button @click="popProductTechProList('','techpro_pro')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="productTechProAddSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
    </el-form>
    <el-dialog :visible.sync="ProductTechProListVisible" append-to-body>
      <ProductTechProList v-if="ProductTechProListVisible" ref="ProductTechProList" :popparams="popparams"> </ProductTechProList>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductTechProList from "@/views/mes/product/ProductTechProList";
  export default {
    name: 'ProductTechProAdd',
    components: {
      ProductTechProList,
    },
    props: ['popparams'],
    data() {
      return {
        ProductTechProListVisible: false,
        ProductTechProListValue: null,
        ProductTechProListDesc: null,
        vueparams: this.getVUEParams(""),
        pro_techpro: {
          techpro_tech: null,
          techpro_pro: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {},
    updated() {},
    mounted() {},
    methods: {
      productTechProAddSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/product/TechnologyAction/productTechProAddSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/mes/product/TechProList/techProList?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      popProductTechProList(desc, value) {
        this.ProductTechProListVisible = true;
        this.ProductTechProListDesc = desc;
        this.ProductTechProListValue = value;
      },
      closeProductTechProList(value, desc) {
        this.ProductTechProListVisible = false;
        this.$set(this.pro_techpro, this.ProductTechProListDesc, desc);
        this.$set(this.pro_techpro, this.ProductTechProListValue, value);
      },
    },
  }
</script>
